//
//  MyShopServiceCell.m
//  BusinessMarket
//
//  Created by Michael Li on 2018/12/12.
//  Copyright © 2018年 Michael Li. All rights reserved.
//

#import "MyShopServiceCell.h"
#import "ServiceModel.h"
@interface MyShopServiceCell()
@property (weak, nonatomic) IBOutlet UIButton *deleBtn;
@property (weak, nonatomic) IBOutlet UIView *view;
@property (weak, nonatomic) IBOutlet UIImageView *iv;
@property (weak, nonatomic) IBOutlet UILabel *titleL;
@property (weak, nonatomic) IBOutlet UILabel *resourceL;
@property (weak, nonatomic) IBOutlet UIView *bottomView;
@end
@implementation MyShopServiceCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.view.layer.cornerRadius = 3;
    self.view.layer.borderColor = kLineColor.CGColor;
    self.view.layer.borderWidth = 1;
    self.iv.layer.borderWidth = 1;
    self.iv.layer.borderColor = k187Color.CGColor;
    self.iv.layer.cornerRadius = 3;
    self.iv.layer.masksToBounds = YES;
//    self.bottomView.layer.cornerRadius = 3;
    self.onOffLineBtn.layer.masksToBounds = YES;
    self.onOffLineBtn.layer.cornerRadius = 3;
    self.deleBtn.layer.masksToBounds = YES;
    self.deleBtn.layer.cornerRadius = 3;
    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bottomView.bounds byRoundingCorners:UIRectCornerBottomLeft|UIRectCornerBottomRight cornerRadii:CGSizeMake(3, 3)];
    CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
    maskLayer.frame = self.bottomView.bounds;
    maskLayer.path = maskPath.CGPath;
    self.bottomView.layer.mask = maskLayer;
    
}
- (void)setIndexPath:(NSIndexPath *)indexPath
{
    _indexPath = indexPath;
}
- (void)setServiceModel:(ServiceModel *)serviceModel
{
    _serviceModel = serviceModel;
    [self.iv sd_setImageWithURL:[NSURL URLWithString:serviceModel.logo] placeholderImage:[UIImage imageNamed:@"headImg"]];
    self.titleL.text = [NSString stringWithFormat:@"%@|%@%@",serviceModel.associationtype,serviceModel.typeSub2List[0],serviceModel.typeSub2List.count>1?[NSString stringWithFormat:@"|%@",serviceModel.typeSub2List[1]]:@""];
    self.resourceL.text = [NSString stringWithFormat:@"服务概述:%@",serviceModel.resource];
}
- (IBAction)deleBtn:(UIButton *)sender {
    if ([self.delegate respondsToSelector:@selector(myShopServiceCell:withBtn:withIndexPath:)]) {
        [self.delegate myShopServiceCell:self withBtn:sender withIndexPath:self.indexPath];
    }
}

- (IBAction)onOffLineBtn:(UIButton *)sender {
    if ([self.delegate respondsToSelector:@selector(myShopServiceCell:withBtn:withIndexPath:)]) {
        [self.delegate myShopServiceCell:self withBtn:sender withIndexPath:self.indexPath];
    }
}

//- (IBAction)changeBtn:(UIButton *)sender {
//    if ([self.delegate respondsToSelector:@selector(myShopServiceCell:withBtn:withIndexPath:)]) {
//        [self.delegate myShopServiceCell:self withBtn:sender withIndexPath:self.indexPath];
//    }
//}
//- (IBAction)operationBtn:(UIButton *)sender {
//    if ([self.delegate respondsToSelector:@selector(myShopServiceCell:withBtn:withIndexPath:)]) {
//        [self.delegate myShopServiceCell:self withBtn:sender withIndexPath:self.indexPath];
//    }
//}

@end
